{extend name="base"}
{block name="body"}
<ol class="breadcrumb">
  <li><a href="#">首页</a></li>
  <li><a href="{:url('admin/index')}">管理员管理</a></li>
  <li class="active">添加管理员</li>
</ol>
<form class="form-horizontal" method="post" enctype="multipart/form-data">
  <div class="form-group">
    <label for="name" class="col-sm-1 control-label">用户名</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" id="username" name="username" placeholder="管理员用户名">
    </div>
  </div>
  <div class="form-group">
    <label for="password" class="col-sm-1 control-label">登录密码</label>
    <div class="col-sm-2">
      <input type="password" class="form-control" name="password" placeholder="管理员登录密码">
    </div>
  </div>
  <div class="form-group">
    <label for="category" class="col-sm-1 control-label">所属角色</label>
    <div class="col-xs-2">
        <select class="form-control" id="level" name="level">
          <option value="1">超级管理员</option>
          <option value="2">网站编辑员</option>
          <option value="3">客服小秘书</option>
          <option value="4">仓库管理员</option>          
        </select>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-1 col-sm-11">
      <button type="submit" class="btn btn-default">提交</button>
    </div>
  </div>
</form>
<script>
  $("#select_category").change(function(){
    $("#select_category option").each(function(){
      if($(this).prop("selected")){
        var pid=this.value;
        $.get('{:url('getCateTwo')}',{pid:pid},function(r){
          $("#select_category_2").html(r);
        });
      }
    });
  });
  $("#select_category_2").change(function(){
    var pid=this.value;
    $.get('{:url('getCateTwo')}',{pid:pid},function(r){
      $("#select_category_3").html(r);
    });
  });
</script>
{/block}